package com.nmsl.system.guahao_charge.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.nmsl.common.annotation.Log;
import com.nmsl.common.core.controller.BaseController;
import com.nmsl.common.core.domain.AjaxResult;
import com.nmsl.common.enums.BusinessType;
import com.nmsl.system.guahao_charge.domain.guahao_gmh;
import com.nmsl.system.guahao_charge.service.Iguahao_gmhService;
import com.nmsl.common.utils.poi.ExcelUtil;
import com.nmsl.common.core.page.TableDataInfo;

/**
 * 挂号费用Controller
 * 
 * @author gmh
 * @date 2025-02-17
 */
@RestController
@RequestMapping("/system/guahao_charge")
public class guahao_gmhController extends BaseController
{
    @Autowired
    private Iguahao_gmhService guahao_gmhService;

    /**
     * 查询挂号费用列表
     */
    @PreAuthorize("@ss.hasPermi('system:guahao_charge:list')")
    @GetMapping("/list")
    public TableDataInfo list(guahao_gmh guahao_gmh)
    {
        startPage();
        List<guahao_gmh> list = guahao_gmhService.selectguahao_gmhList(guahao_gmh);
        return getDataTable(list);
    }

    /**
     * 导出挂号费用列表
     */
    @PreAuthorize("@ss.hasPermi('system:guahao_charge:export')")
    @Log(title = "挂号费用", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, guahao_gmh guahao_gmh)
    {
        List<guahao_gmh> list = guahao_gmhService.selectguahao_gmhList(guahao_gmh);
        ExcelUtil<guahao_gmh> util = new ExcelUtil<guahao_gmh>(guahao_gmh.class);
        util.exportExcel(response, list, "挂号费用数据");
    }

    /**
     * 获取挂号费用详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:guahao_charge:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(guahao_gmhService.selectguahao_gmhById(id));
    }

    /**
     * 新增挂号费用
     */
    @PreAuthorize("@ss.hasPermi('system:guahao_charge:add')")
    @Log(title = "挂号费用", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody guahao_gmh guahao_gmh)
    {
        return toAjax(guahao_gmhService.insertguahao_gmh(guahao_gmh));
    }

    /**
     * 修改挂号费用
     */
    @PreAuthorize("@ss.hasPermi('system:guahao_charge:edit')")
    @Log(title = "挂号费用", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody guahao_gmh guahao_gmh)
    {
        return toAjax(guahao_gmhService.updateguahao_gmh(guahao_gmh));
    }

    /**
     * 删除挂号费用
     */
    @PreAuthorize("@ss.hasPermi('system:guahao_charge:remove')")
    @Log(title = "挂号费用", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(guahao_gmhService.deleteguahao_gmhByIds(ids));
    }
}
